package net.neptech.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;

/**
 * WebSocketContainerConfig.java
 * 优化性能用
 */

@Configuration
public class WebSocketContainerConfig {
    @Bean
    public ServletServerContainerFactoryBean createWebSocketContainer() {
        ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
        container.setMaxBinaryMessageBufferSize(1024 * 1024); // 1MB，按需再调大
        container.setMaxSessionIdleTimeout(300000L); // 5分钟
        container.setAsyncSendTimeout(30000L);
        return container;
    }

}
